
const _docVersion = "1.3.3"

function PlugReceiver() {
}

(function () {
    let r = loadDex("laoleng.apk")
    if (r) {
        logw("java插件加载成功")
        PlugReceiver.contact = new com.laoleng.ContactUtils(context)
    } else {
        exit()
    }
})()

function Contact(){}

function LaolengPlug() {
    this.contact = new Contact()
}

const ll = new LaolengPlug()

Contact.prototype.getAllContacts = function () {
    let contactList = PlugReceiver.contact.getAllContacts()
    let tmp_contactList = []
    for (let i = 0; i < contactList.length; i++) {
        tmp_contactList.push(contactList[i])
    }
    if (tmp_contactList.length === 0) return null
    return tmp_contactList

}
Contact.prototype.addContact = function (name, phone, nickName) {
    nickName = nickName || ""
    if (!name) {
        loge("参数错误,名字为必填项")
        return false
    }
    if (!phone) {
        loge("参数错误,手机号为必填项")
        return false
    }
    return PlugReceiver.contact.addContact(name, phone, nickName)
}
